package com.example.springboot.controller.feign;

import com.example.springboot.bean.Department;
import com.example.springboot.entity.ResultData;
import com.example.springboot.exception.FeignException;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:ChenZhangKun
 * @Date: 2022/11/26 15:03
 */
@RestController
@RequestMapping("/feign")
public class FeignController {

    @GetMapping("test")
    public ResultData success(@RequestParam("msg") String msg) {
        if (msg.equals("czk")) {
            throw new FeignException("名字异常");
        }
        Department department = new Department();
        department.setId(4);
        department.setDepartmentName("nzq");
        return ResultData.ok(department);
    }
}
